#include "get_arg.h"
#include <iostream>
#include <simple_suffix_array.h>
#include <stdlib.h>
#include <sstream>
#include <fstream>
#include <portable_timer.h>
#include <get_filename.h>
#include <print_error.h>
#include <string_partial_match.h>
#include <boost/foreach.hpp>
#include <boost/tuple/tuple.hpp>
#include <cstdlib>


using namespace std;
using namespace bcpp_matrix;
using boost::lexical_cast;
using std::ostringstream;
using std::istringstream;
using std::ofstream;
using std::string;
using std::vector;
using std::ifstream;


int main (int argc, char *argv[])
{
	t_program_args args;
	try
	{
		if (!process_command_line_options(argc, argv, args))
			return 1;
		t_string_partial_matches options;
		std::vector<string> strings;
		strings.push_back("blosum62");
		strings.push_back("blosum80");
		strings.push_back("dna");
		strings.push_back("62");
		strings.push_back("80");
		cout << "strings=\n";
		BOOST_FOREACH(const string& s, strings) 
			cout << s << "\n";
		options.add_regex("blosum62", 0);
		options.add_regex("blosum80", 1);
		options.add_regex("dna", 2);
		options.add_regex("62", 0, t_string_partial_matches::eMATCH_FULL);
		options.add_regex("80", 1, t_string_partial_matches::eMATCH_FULL);

		cout << "Enter Test String:" << std::endl;
		string test_string;
		while (getline(cin, test_string) && test_string.length())
		{
			cout << "Entered: ["<<test_string <<"]\n";
			std::vector<unsigned> matching_results	;
			options.find_matches(test_string, matching_results);
			BOOST_FOREACH(unsigned i, matching_results) 
			{
				cout << "Matched: " << i << "= " << strings[i] << std::endl;
			}
		}
	}
	catch (std::exception& e)
	{
		std_print_error(args.CERR(),  e.what());
		return 1;

	}
	return 0;






	cerr << "\n";
	cerr << string(10, '!') << "\nEverything worked!!\n";

	return 0;
}


